package com.tulingxueyuan.mall.security.tulingtest.singlon;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author :     sunting
 * @date :    2023/6/5 11:28
 * @description :
 */
//double check
public class Singlon4 {
    private static volatile Singlon4 instance;
    public static Singlon4 getInstance(){
        if(instance == null){
            synchronized (Singlon4.class){
                if(instance == null){
                    instance = new Singlon4();
                }
            }
        }
        return instance;
    }

    public static void main(String[] args) {
        System.out.println(Singlon4.getInstance());
        System.out.println(Singlon4.getInstance());
        new LinkedBlockingQueue<>();

        new ReentrantLock();
    }
}
